package net.wzw.enums;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * @author wzw
 * @date 2025/4/20
 * @Description
 */
public enum FoodTime {
    

    /*
    *
    * 10分钟之内
     */
    WITHIN_TEN_MINUTES(1, "10分钟之内"),

    /*
     *
     * 10-30分钟之内
     */
    WITHIN_TEN_TO_THIRTY_MINUTES(2,"30分钟之内"),

    /*
     *
     * 30-60分钟之内
     */
    WITHIN_THIRTY_TO_SIXTY_MINUTES(3,"30-60分钟"),

    /*
     *
     *  1小时以上
     */
    MORE_AN_HOUR(4,"1小时以上");

    private Integer time;

    private String timeValue;

    FoodTime(int i, String s) {
        this.time = time;
        this.timeValue = timeValue;
    }


    public Integer getTime() {
        return time;
    }

    public void setTime(Integer time) {
        this.time = time;
    }

    public String getTimeValue() {
        return timeValue;
    }

    public void setTimeValue(String timeValue) {
        this.timeValue = timeValue;
    }

    public static Map<Integer,String> toMap(){

        Map<Integer, String> map = Maps.newHashMap();
        for (FoodTime element : FoodTime.values()) {
            map.put(element.getTime(), element.getTimeValue());
        }
        return map;

    }

    /**
     * 根据 time 获取对应 timeValue
     * @param time
     * @return
     */
    public static FoodTime getByTime(Integer time) {
        if (time == null) {
            return null;
        }
        for (FoodTime element : FoodTime.values()) {
            if (time.equals(element.getTime())) {
                return element;
            }
        }
        return null;
    }
    
}
